package com.yuju.login.dao.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.yuju.common.core.dao.AbstractBaseDao;
import com.yuju.login.dao.IMemberDao;
import com.yuju.login.dao.entity.Member;
import com.yuju.login.dao.mapper.MemberMapper;
import com.yuju.login.model.MemberModel;
import com.yuju.persist.base.mapper.BaseMapper;
/**
 * 
 * 类名：MemberDaoImpl  <br />
 *
 * 功能：
 *
 * @author : zhousc <br />
 * @Date : 2017年11月27日 上午10:32:28  <br />
 * @version : 1.1 <br />
 */
@Repository
public class MemberDaoImpl  extends AbstractBaseDao<MemberModel, Member, String> implements IMemberDao{
	@Autowired
	private MemberMapper memberMapper;
	
	@Override
	public BaseMapper<Member, String> getMapper() {
		// TODO Auto-generated method stub
		return memberMapper;
	}

	@Override
	public MemberModel getMember(MemberModel model) {
		Map<Object, Object> map = getBeanMap(model);
		if (null == map || map.isEmpty()) {
			return null;
		}
		
		Member member = memberMapper.getMemberByMap(map);
		if (null == member) {
			return null;
		}
		return convertP2M(member);
	}
}
